package org.example.springbootdeptemp.controller;

import org.example.springbootdeptemp.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.example.springbootdeptemp.pojo.Result;
import java.io.IOException;

/**
 * 创建者： 智晟全哥
 */
@RestController
@RequestMapping("/testUpload")
public class MyUploadTestController {

    @Autowired
    private FileService fileService;

    @PostMapping("/upload")
    public Result upload(String name,MultipartFile image) throws IOException {
        System.out.println("name="+name);
        String s = fileService.saveFile(image);
        return Result.success();
    }

}
